#ifndef WIDGET_H
#define WIDGET_H

#include <QWidget>
#include <QLineEdit>
#include <QLabel>
#include <QPushButton>
#include <QSpinBox>
#include <QMessageBox>

#include <QGridLayout>
#include <QVBoxLayout>
#include <QDir>
#include <QFileInfo>
#include <QImage>

#include <QDebug>

class Widget : public QWidget
{
    Q_OBJECT

public:
    Widget(QWidget *parent = nullptr);
    ~Widget();

    int toGray(QRgb rgb);
    template<typename T> void safeDelete(T *&t);

private slots:
    void onBtnClicked();

private:
    QLabel *mLabPath = new QLabel("路径:");
    QLineEdit *mEditPath = new QLineEdit;

    QLabel *mLabName = new QLabel("文件名:");
    QLineEdit *mEditName = new QLineEdit("d-%1.png");

    QLabel *mLabStart = new QLabel("数字起始:");
    QSpinBox *mEditStart = new QSpinBox;

    QLabel *mLabGrayThr = new QLabel("黑白阈值:");
    QSpinBox *mEditGrayThr = new QSpinBox;

    QLabel *mLabFnName = new QLabel("画点函数名:");
    QLineEdit *mEditFnName = new QLineEdit("SetLCDDot");

    QLabel *mLabXSum = new QLabel("x递增");
    QSpinBox *mEditXSum = new QSpinBox;

    QLabel *mLabYSum = new QLabel("y递增");
    QSpinBox *mEditYSum = new QSpinBox;

    QLabel *mLabIndexSum = new QLabel("序号递增");
    QSpinBox *mEditIndexSum = new QSpinBox;

    QPushButton *mBtnOK = new QPushButton("确定");
};

#endif // WIDGET_H
